package com.bci.pwtz.service.impl;

import java.util.Date;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;

import com.bci.pwtz.exception.PwtzDatabaseException;
import com.bci.pwtz.mysql.dao.SmsSendLogMapper;
import com.bci.pwtz.mysql.model.SmsSendLog;
import com.bci.pwtz.service.SmsSendLogService;

public class SmsSendLogServiceImpl implements SmsSendLogService
{
    private static final Logger _logger = Logger.getLogger(SmsSendLogServiceImpl.class);
    private SmsSendLogMapper smsSendLogMapper;
    public void setSmsSendLogMapper(SmsSendLogMapper smsSendLogMapper)
    {
        this.smsSendLogMapper = smsSendLogMapper;
    }
    
    @Override
    public SmsSendLog add(SmsSendLog smsSendLog) throws PwtzDatabaseException
    {
        if(_logger.isDebugEnabled())
        {
            _logger.debug("add:smsSendLog="+smsSendLog.toString());
        }
        try
        {
            smsSendLog.setCreateTime(new Date());
            smsSendLogMapper.insertSelective(smsSendLog);
            return smsSendLog;
        }
        catch(DataAccessException e)
        {
            _logger.error(ExceptionUtils.getStackTrace(e));
            throw new PwtzDatabaseException();
        }
    }




}
